home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tvbugsp1.zip / TVBUGS.PAS < prev   
Pascal/Delphi Source File  |  1993-05-20  |  33KB  |  1,046 lines

  1.              Borland Turbo Vision (Pascal) Bug List
  2.  
  3.  
  4. Last Updated: 5/4/93
  5.  
  6. Maintained by: Brad Williams
  7.                bwilliams@marvin.ag.uidaho.edu
  8.  
  9.  
  10. *** This list is PASCAL TurboVision (TV) specific.  For a C++
  11. specific buglist, see the file \turbo-vision\cpp\tvbugs.cpp
  12. maintained by Marc Stern (stern@mble.philips.be) on this ftp
  13. site.  All bugs and fixes presented have been discussed on the
  14. listserv TurbVis.  For compiler specific bugs, see the bug
  15. lists TP6BUGSx.ZIP and BP7BUGSx.ZIP maintained by Duncan
  16. Murdoch (dmurdoch@mast.QueensU.CA) on garbo.uwasa.fi in the
  17. \pc\turbopas directory.  Many of the bugs and patches listed
  18. are converted from a list formerly maintained by Juergen
  19. Schlegelmilch.  Great appreciation for his prior efforts.
  20.  
  21. This list contains bug fixes and enhancements to the TV
  22. sources.  These enhancements are obviously subjective and rely
  23. most of the time on personal feelings of the posters about the
  24. look and feel of their applications.
  25.  
  26. *** This is an unofficial list and is not a substitute for
  27. *** Borland Technical or customer support which can be reached
  28. *** at 800-331-0877 for registered Borland product owners.
  29. *** Borland customer on-line service can be reached at
  30. ***
  31. ***           customer-support@borland.com
  32. ***
  33. *** Online technical support is not available.  Borland's
  34. *** internet address for reporting bugs is
  35. ***
  36. ***           bugs@borland.com
  37.  
  38. All submissions determined to be "true" bugs will be forwarded
  39. to Borland.  The maintainer of this list, the authors of bug
  40. fixes, and the ftp site are not responsible for the reliability
  41. of any information presented in this document.
  42.  
  43. *** Always make a backup of the source code file under a new
  44. *** name prior making any changes to the original file.
  45.  
  46. Send all comments about bugs you have discovered and any
  47. patches to the maintainer of this list or to the TurbVis
  48. listserv for discussion.  Please include a description of the
  49. problem you are having, a small section of source code which
  50. will duplicate the problem when compiled/run.  All
  51. suggestions for improvement of current patches are appreciated.
  52.  
  53.  
  54. How to Use This List
  55. --------------------
  56. At the beginning of this list is an index of new
  57. problems/enhancements/questions or changes to old
  58. problems/enhancements/questions in reverse chronological order.
  59. This facilitates quick review for changes from previous
  60. additions.  Following is the list of
  61. problems/enhancements/questions about TV in topical order.
  62. They are discussed and source code patches referenced where
  63. available. All source code patches in this file are placed at
  64. the end in alphabetic order according to the procedure,
  65. function, or object's name, then by individual object method.
  66. For example,
  67.  
  68.          AddToBuffer
  69.          TCollection.Init
  70.          TCollection.Load
  71.          TObject.Free
  72.          TProgram.Exec
  73.  
  74. If extensive files are required, the individual file will be
  75. referenced under the appropriate problem/enhancement/question.
  76.  
  77. There are two possible methods for searching this document, by
  78. topic under the PROBLEMS/QUESTIONS section or by procedure,
  79. function, or object method name under the PATCHES section.  All
  80. PROBLEMS/QUESTIONS and PATCHES are cross-referenced.  If you do
  81. not find the topic/patch in one list, check the other.  If you
  82. still cannot find a solution look at the FAQ (TVPAS.FAQ) posted
  83. at this site.  If you still cannot determine a solution to your
  84. problem, post a message to the listserv TurbVis.
  85.  
  86. ---------------------------------------------------------------
  87.        CHRONOLOGICAL INDEX OF CHANGES TO THIS DOCUMENT
  88. ---------------------------------------------------------------
  89. 5-10-93 - First edition of this list
  90.    Drivers - 1
  91.    Editors - 1,2,3,4,5,6,7
  92.    Help - 1,2,3
  93.    Outlines - 1
  94.    Streams - 1
  95.    Views - 1,2,3
  96.    Windows - 1
  97.  
  98. ---------------------------------------------------------------
  99.              PROBLEMS / ENHANCEMENTS / QUESTIONS
  100. ---------------------------------------------------------------
  101. Drivers
  102. -------
  103. 1. Problem   : Calling MoveBuf (unit Drivers) with an Attr
  104.                parameter of 0 would produce a corrupt draw
  105.                buffer.
  106.    Version   : 1.0
  107.    Type      : Bug
  108.    Reference : MoveBuf
  109.  
  110.    There is a STOSB instruction where a MOVSB should be.
  111.  
  112.  
  113. Editors
  114. -------
  115. 1. Problem: When TFileEditor is Loaded from a stream it gives
  116.             unusual codes in the edit window and sometimes
  117.             hangs the system.
  118.    Version: 1.0, 2.0
  119.    Type   : Bug
  120.    Patch  : TFileEditor.InitBuffer
  121.  
  122.    TFileEditor.NewBuffer allocates 0 bytes, but does not set
  123.    BufSize to 0. If TFileEditor.Load loads a TFileEditor from a
  124.    stream,  BufSize is read from the stream, too, and has its
  125.    old value.  InitBuffer (called by TEditor.Load) ignores it,
  126.    so the content of the editor is loaded into memory, which
  127.    was never allocated -> the program will crash. So you can't
  128.    use TFileEditors, if you store and load the desktop.
  129.  
  130.  
  131. 2. Problem: When I try to "find" text in an editor window the
  132.             program crashes.
  133.    Version: 1.0
  134.    Type   : Bug
  135.    Patch  : IScan
  136.  
  137.    In this assembly-routine the programmer forgot that MOV
  138.    does not set the flags. If the search string nearly matches
  139.    the last chars in the text, the routine runs over the end of
  140.    the text -- eventually replacing text! Here is an example:
  141.    Let '123456' be the text, and search for '45z'.
  142.    The routine scans the text '1234' for the '4' and finds it:
  143.          123456
  144.             45z
  145.    Then it compares the rest, finds the difference and skips
  146.    this occurence. CX (number the chars left in the text) is
  147.    now 0, but the routine just MOVs it back from DX, jumping
  148.    then with JNE. Now it is behind the end of text!
  149.  
  150.  
  151. 3. Problem: All scroll bar events are "stolen" by TMemo when
  152.             used in a TDialog with any other view that has a
  153.           scroll bar.
  154.    Version: 1.0
  155.    Type   : Bug
  156.    Patch  : TEditor.HandleEvent
  157.  
  158.    This routine consumes all cmScrollBarChanged-events, without
  159.    testing the sender. With TEditor, everything is ok, but with
  160.    TMemo, there is a problem.  TMemo cannot coexist in a
  161.    TDialog with other objects having scrollbars. The test, whe-
  162.    ther a cmScrollBarChanged-event is from one of its own
  163.    scroll bars is done in the local procedure CheckScrollBar,
  164.    but the HandleEvent routine clears the event in any case.
  165.  
  166.  
  167. 4. Problem : Unpredictable results after insufficient memory
  168.              when overwriting text.
  169.    Version : 1.0
  170.    Type    : Bug
  171.    Patch   : TEditor.InsertBuffer
  172.  
  173.    Overwriting chars in an TEditor object is done in
  174.    TEditor.HandleEvent by marking the next char as block and
  175.    calling InsertBuffer via InsertText. This routine checks,
  176.    whether there is enough memory and complains
  177.    (edOutOfMemory), but does not reset the block marker. If you
  178.    now press backspace, the block is deleted (i.e. the char
  179.    under the cursor), not the char on the left side of the
  180.    cursor.
  181.  
  182.    Example:
  183.    Be sure to compile TVDEMOS\TVEDIT.PAS without the Range
  184.    Check option; there seems to be another minor bug
  185.    concerning Integer and Word types. Start TVEDIT.EXE, open a
  186.    new edit window and start typing until the messagebox 'Not
  187.    enough memory for this operation' comes up. Press Enter to
  188.    close the messagebox, move the cursor in the middle of a
  189.    line and type until the messagebox comes up again. Press
  190.    Enter to close it again and then press Backspace. Not the
  191.    char on the left side of the cursor will be deleted, but
  192.    the char at cursor position.
  193.  
  194.  
  195. 5. Problem : ^T sometimes deletes more than the next word.
  196.    Version : 1.0
  197.    Type    : Enhancement
  198.    Patch   : TEditor.NextWord
  199.  
  200.    ^T deletes _up to the next_ word, to be exact: up to the
  201.    next char out of
  202.    WordChars: set of Char = ['0'..'9', 'A'..'Z', '_', 'a'..'z']
  203.    This will usually be just the next word, but can be more.
  204.    The IDE editor first skips the current word if the cursor is
  205.    in one. Then it skips blanks and tabs up to the next
  206.    non-blank/non-tab.
  207.  
  208. 6. Problem : ^QF followed by ^L followed by Space deletes words
  209.              in TVEdit.
  210.    Version : 1.0
  211.    Type    : Bug
  212.    Patch   : TEditor.HandleEvent
  213.  
  214.    If you mark a block manually and type a key, the block will
  215.    be replaced by the key. Because occurences of the search
  216.    string are marked as block, the described effect is seen. If
  217.    you really want to avoid it, you have to change
  218.    TEditor.HandleEvent to clear the blockmarkers before
  219.    inserting a normal char.  Corrected in version 2.0.
  220.  
  221. 7. Problem : The number keys 3-6 can not be entered.
  222.    Version : 1.0
  223.    Type    : Bug
  224.    Patch   : TEditor.ConvertEvent
  225.  
  226.    There are actually two changes listed under ConvertEvent
  227.    that need to be made.
  228.  
  229.  
  230. Help
  231. ----
  232. 1. Problem : Garbage added instead of a defined cross-
  233.              reference.
  234.    Version : 1.0
  235.    Type    : Bug
  236.    Patch   : THelpFile.AddCrossReference
  237.  
  238.   In this routine the programmer allocates memory and then
  239.   forgets to use the pointer to it. He just forgot a line.
  240.  
  241. 2. Problem : Get a run time error if Range Checking is on or a
  242.              randomly chosen help text or garbage displayed
  243.              with Range Checking turned off when a help topic
  244.              context does not.
  245.    exist.
  246.    Version : 1.0
  247.    Type    : Bug
  248.    Patch   : THelpIndex.Position
  249.  
  250.    If called with a negative argument, it returns random
  251.    values, since it checks only for the upper bound, not for
  252.    the lower one. The help compiler TVHC uses -1 for unknown
  253.    topics, so this doesn't work.
  254.  
  255.    Example:
  256.    Compile TVDEMOS\TVDEMO.PAS to disk. Then add the line {abc}
  257.    to the first topic in TVDEMOS\DEMOHELP.TXT and compile it
  258.    with TVHC DEMOHELP.TXT.  This will produce DEMOHELP.HLP and
  259.    DEMOHELP.PAS. Start TVDEMO.EXE, press F1 to see the general
  260.    help and then Enter to follow the cross reference 'abc'.
  261.    You will not see the text 'No help available in this
  262.    context.', as intended by HELPFILE.PAS, but get a runtime
  263.    error (if you compiled TVDEMO with Range Check option) or a
  264.    randomly chosen help text if any (without Range checking).
  265.  
  266. 3. Problem : If range checking is not enabled, the system hangs
  267.              or TVHC crashes with a runtime error 204 if a
  268.              large help topic is read into TVHC.
  269.    Version : 1.0
  270.    Type    : Bug
  271.    Patch   : AddToBuffer
  272.  
  273.    In TV 1.0 AddToBuffer has the incorrect assembler routine.
  274.    (Not tested for CopyToBuffer in version 2.0)
  275.  
  276.    No range checking is done in this routine. If a paragraph is
  277.    longer than specified in the constant BufferSize
  278.    (default:1024), memory behind the buffer is overwritten,
  279.    resulting in crash.
  280.  
  281.    Example:
  282.    Create a file TESTHELP.TXT with this content:
  283.     .topic TestContext
  284.     The following paragraph is too long to fit into the
  285.     standard-sized buffer of TVHC.PAS:
  286.       1234567890123456789012345678901234567890
  287.       1234567890123456789012345678901234567890
  288.  
  289.         .. another 100 lines likes these ..
  290.  
  291.       1234567890123456789012345678901234567890
  292.       1234567890123456789012345678901234567890
  293.    Now start TVHC on it:   TVHC TESTHELP.TXT
  294.    Your system will hang, if you haven't compiled TVHC with
  295.    Range Check option, otherwise you will get a runtime error
  296.    204.
  297.  
  298.  
  299. OutLines
  300. --------
  301.  
  302. 1. Problem : Run out of memory when using the Outline unit.
  303.    Version : 2.0
  304.    Type    : Bug
  305.    Patch   : DisposeNode
  306.  
  307.    The DisposeNode procedure in the Outlines unit neglects to
  308.    dispose of the Text string allocated by NewNode.  This means
  309.    that disposing of a POutline object leaves all the strings
  310.    sitting in memory.  It also has redundant tests to avoid
  311.    disposing of a nil pointer.
  312.  
  313.  
  314. Streams
  315. -------
  316.  
  317. 1. Problem : TBufStream sometimes writes garbage to the stream.
  318.    Version : 1.0
  319.    Type    : Bug
  320.    Patch   : FlushBuffer
  321.  
  322.    The local procedure FlushBuffer in the WObjects and Objects
  323.    units has an incorrect JE instruction.
  324.  
  325.  
  326. Views
  327. -----
  328.  
  329. 1. Problem - The path returned by TFileDialog is incorrect.
  330.    Version: 1.0, 2.0
  331.    Type : Bug
  332.    Patch: TFileDialog.GetFileName
  333.  
  334.    The GetFileName method receives an incorrect result from the
  335.    RelativePath function. RelativePath is actually not a method
  336.    of TFileDialog, but a local function in the GetFileName
  337.    method. The assignment of the RelativePath result is
  338.    incorrect.
  339.  
  340. 2. Problem : System hangs when attempting to open a file using
  341.              TFileDialog with a "*" as the wildcard.
  342.    Version : 1.0, 2.0?
  343.    Type    : Bug
  344.    Patch   : NoWildChars
  345.  
  346.    This routine is used by TFileDialog-objects to delete
  347.    wildcards in filenames. If called with an empty argument, it
  348.    overwrites the stack. Try it: just give first '*' as mask,
  349.    then a name with no extension in a TFileDialog.
  350.  
  351.    Example:
  352.    TVDEMOS\TVDEMO.PAS. Create the file TEST (no extension!),
  353.    then start TVDEMO.EXE. Press F3 to invoke the FileOpen
  354.    dialog. Type "*" without the quote marks, press Enter,
  355.    choose TEST from the file list and press Enter again: The
  356.    system hangs.
  357.  
  358. 3. Problem : Poor quality history buttons.
  359.    Version : 1.0, 2.0
  360.    Type    : Bug
  361.    Patch   : None (THistory.Draw)
  362.  
  363.    THistory.Draw (Unit Dialogs) uses chars ASCII 221 and 22 for
  364.    the history button sides. These chars are _not_ included in
  365.    codepages other than 437 (e.g. codepage 850, recommended by
  366.    IBM for europe). So, the button looks somewhat awful in
  367.    europe.
  368.    Example:
  369.    To use codepage 850 with your display, include the lines
  370.    (with correct paths, of course)
  371.       nlsfunc.exe country.sys
  372.       mode con cp prepare=((850)ega.cpi)
  373.    in your AUTOEXEC.BAT and type CHCP 850 at the DOS prompt
  374.    after startup. DOS will complain, because you haven't
  375.    prepared this codepage for all devices, but this doesn't
  376.    matter. Start TVDEMOS\TVDEMO and press F3 to invoke a
  377.    TFileDialog with a history button on the left side of the
  378.    'Name' input line. Look at the System-menu symbol for
  379.    another example of such incompatibly written software.
  380.  
  381.  
  382. Windows
  383. -------
  384.  
  385. 1. Problem : A window that has neither the wfGrow now wfMove
  386.              flags set does not disable the cmResize command
  387.              when it is active.
  388.    Version : 1.0, 2.0
  389.    Type    : Bug
  390.    Patch   : TWindow.SetState
  391.  
  392.    A pair of parentheses is missing in the TWindow.SetState
  393.    method so that Flags and wfGrow are AND'd the wfGrow added
  394.    to them.  The result is always nonzero and will result in
  395.    always disabling the cmResize.
  396.  
  397.  
  398. ---------------------------------------------------------------
  399.  
  400.                          PATCHES
  401. ---------------------------------------------------------------
  402. Procedure : AddToBuffer
  403. Version   : 1.0
  404. Type      : Bug
  405. File      : Tvhc.pas
  406. Reference : Help.3
  407. Submitter : Juergen Schlegelmilch
  408. Patch     :
  409.  
  410. TV 1.0  procedure AddToBuffer(var Line: String; Wrapping:
  411.                               Boolean);
  412.  
  413.  assembler;
  414.   asm
  415.           PUSH    DS
  416.           CLD
  417.           PUSH    DS
  418.           POP     ES
  419.           MOV     DI,OFFSET Buffer
  420.           ADD     DI,Ofs
  421.           LDS     SI,Line
  422.           LODSB
  423.           XOR     AH,AH
  424.  { ** patch: the following test is missing in the original ** }
  425.  { ** version. Causes crashes on buffer overflow           ** }
  426.           MOV     BX,BufferSize { BufferSize-Ofs is the space
  427.                                 left in Buffer }
  428.           SUB     BX,ES:Ofs
  429.           CMP     BX,AX { AX holds the needed amount of space }
  430.           JAE     @@0           { enough -> ok }
  431.           MOV     AX,BX        { else just fill the Buffer up }
  432.   @@0:
  433.           ADD     ES:Ofs,AX
  434.           XCHG    AX,CX
  435.           JCXZ    @@3          { don't copy 64K if there is
  436.                                 nothing to do }
  437.           REP     MOVSB
  438.           CMP     ES:Ofs,BufferSize
  439.           JE      @@3           { don't append ' '/#13 if there
  440.                                   is no room }
  441.           XOR     AL,AL
  442.           INC     ES:Ofs
  443.           TEST    Wrapping,1    { Only add a #13, line
  444.                                 terminator, if not }
  445.           JE      @@1           { currently wrapping the text.
  446.                                  Otherwise  }
  447.           MOV     AL,' '-13     { add a ' '. }
  448.   @@1:    ADD     AL,13
  449.   @@2:    STOSB
  450.   @@3:
  451.           POP     DS
  452.   end;
  453.  
  454. ---------------------------------------------------------------
  455.  
  456. Function : DisposeNode
  457. Version  : 2.0
  458. Type     : Bug
  459. File     : Outline.pas
  460. Reference: Outline.1
  461. Submitter: ?
  462. Patch    :
  463.  
  464.    CHANGE FROM:
  465.  
  466.    procedure DisposeNode(Node: PNode);
  467.    begin
  468.      if Node <> nil then
  469.        with Node^ do
  470.        begin
  471.          if ChildList <> nil then DisposeNode(ChildList);
  472.          if Next <> nil then DisposeNode(Next);
  473.        end;
  474.      Dispose(Node);
  475.  
  476.    CHANGE TO:
  477.  
  478.    procedure DisposeNode(Node: PNode);
  479.    begin
  480.      if Node <> nil then
  481.        with Node^ do
  482.          begin
  483.            DisposeNode(ChildList);
  484.            DisposeNode(Next);
  485.            DisposeStr(Text);
  486.            Dispose(Node);
  487.          end;
  488.    end;
  489.  
  490. ---------------------------------------------------------------
  491.  
  492. Function : FlushBuffer
  493. Version  : 1.0
  494. Type     : Bug
  495. File     : WObjects.pas, Objects.pas
  496. Reference: Streams.1
  497. Submitter: Borland (Amrik Dhillon)
  498. Patch    :
  499.  
  500.    Two possibilites, source code patch or TPU patch with DEBUG.
  501.  
  502.    Source Code - In the FlushBuffer procedure, change the first
  503.       "JE @@4" instruction to "JE @@3".
  504.  
  505.    Using DEBUG <g>,
  506.  
  507.    In WObjects.TPU
  508.  
  509.    -e7ca3
  510.        43.35
  511.    -w
  512.  
  513.    In Objects.TPU
  514.  
  515.    -e2c75
  516.        45.37
  517.  
  518.    -w
  519.  
  520.  
  521. ---------------------------------------------------------------
  522.  
  523. Function : IScan
  524. Version  : 1.0
  525. Type     : Bug
  526. File     : Editors.pas
  527. Reference: Editors.2
  528. Submitter: Juergen Schlegelmilch
  529. Patch    :
  530.  
  531. (* Comment: The only change needed is the line marked with ***.
  532.    But for better use of TEditor objects outside the USA and
  533.    GB, it's better to use the DOS codepage (MSDOS3.X or higher
  534.    required) for case conversion. *)
  535.  
  536.   { Improvement JS: UpperCase uses DOS codepage }
  537.   procedure DOSUpCase; assembler;
  538.   { a dummy to get a pointer in the codesegment }
  539.   asm
  540.           DD 0
  541.   end;
  542.  
  543.   function UpperCase:Char ; assembler ;
  544.   { changes lower case to upper case letters, using DOS
  545.   codepage. Does not need DS to point to Turbo's global data
  546.  segment.
  547.     input : AL char
  548.     output: AL upper case of it }
  549.   asm
  550.        CMP  AL,'a'           { normal lower case chars.. }
  551.        JB   @@1
  552.        CMP  AL,'z'
  553.        JBE  @@4              { .. get normal treatment. }
  554.        DB   $2E,$FF,$1E      { this is a CALLF [cs:] }
  555.        DW   DOSUpCase        { all others are converted using }
  556.        JMP  @@1              { the DOS codepage }
  557.   @@4:
  558.        SUB AL,20H
  559.   @@1:
  560.   end ;
  561.  
  562.   function UpCase(c:Char): Char; assembler;
  563.   { should be exported, i.e. included in interface }
  564.   asm
  565.        MOV   AL,c
  566.        CALL UpperCase
  567.   end;
  568.  
  569.   function IScan(var Block; Size: Word; Str: String): Word;
  570. assembler;
  571.   var
  572.     S: String;
  573.   asm
  574.    PUSH  DS
  575.    MOV   AX,SS        { copy the Str to S, converting it.. }
  576.    MOV   ES,AX        { to upper case }
  577.    LEA   DI,S
  578.    LDS   SI,Str
  579.    XOR   AH,AH
  580.    LODSB              { copy string length }
  581.    STOSB
  582.    MOV   CX,AX
  583.    MOV   BX,AX
  584.    JCXZ  @@9
  585. @@1:    LODSB         { load each char from Str.. }
  586.    CALL  UpperCase    { get upper case of it.. }
  587.    STOSB              { and store it to S }
  588.    LOOP  @@1
  589.    SUB   DI,BX    { goto beginning of S (without length byte) }
  590.    LDS   SI,Block
  591.    MOV   CX,Size
  592.    JCXZ  @@8
  593.    CLD
  594.    SUB   CX,BX        { no need to examine the last chars in..}
  595.    JB    @@8          { Block, the search string won't fit }
  596.    INC   CX
  597. @@4:    MOV   AH,ES:[DI]  { search for the first char of search
  598.                             string }
  599. @@5:    LODSB
  600.    CALL  UpperCase
  601.    CMP AL,AH     { compare chars from Block with first char.. }
  602.    LOOPNE @@5         { of search string until found }
  603.    JNE   @@8          { no occurence -> goto end }
  604.    DEC   SI           { compare the whole search string }
  605.    MOV   DX,CX      { save number of remaining bytes in Block }
  606.    MOV   CX,BX        { get search string length }
  607. @@6:    REPE  CMPSB   { exact match.. }
  608.    JE    @@10         { up to end of search string -> success }
  609.    MOV   AL,DS:[SI-1] { else: }
  610.    CALL  UpperCase    { compare upper case }
  611.    CMP   AL,ES:[DI-1]
  612.    JE    @@6          { matches -> continue }
  613.    SUB   CX,BX      { else compare failed; restore pointers.. }
  614.    ADD   SI,CX        { in Block.. }
  615.    ADD   DI,CX        { and search string }
  616.    INC   SI
  617.    MOV   CX,DX   { restore number of remaining bytes in Block }
  618.    OR    CX,CX        { *** MOV does not modify the flags! ***}
  619.    JNE   @@4          { zero remaining bytes -> end }
  620. @@8:    XOR   AX,AX   { end without success: return 0 }
  621.    JMP   @@11
  622. @@9:    MOV   AX, 1   { end with empty search string:.. }
  623.    JMP   @@11         { pointer to next char }
  624. @@10:   SUB   SI,BX   { end with success: return pointer to.. }
  625.    MOV   AX,SI        { found occurence }
  626.    SUB   AX,WORD PTR Block
  627.    INC   AX
  628. @@11:   DEC   AX      { set correct range of AX for BOOLEAN }
  629.    POP DS
  630.   end;
  631.  
  632. { an init routine, replacing the END. at end of EDITORS.PAS}
  633.   const RetFar:Byte=$CB ;
  634.   var i: Integer;
  635.   begin
  636.     { Improvement JS: UpperCase uses DOS codePage }
  637.     asm
  638.       push  ds
  639.       mov   ds,PrefixSeg
  640.       mov   dx,$D0 { DS:DX = 32 bytes scratch area in the PSP }
  641.       mov   ax,$3800      { get extended country information }
  642.       int   21h
  643.       mov   bx,dx
  644.       mov   ax,[bx+$12]   { Pointer to case conversion
  645.                           routine.. }
  646.       mov   bx,[bx+$14]   { for chars >80h }
  647.       pop   ds
  648.       jnc   @@ok       { if DOS reports error, set it to RETF }
  649.       mov   ax,Offset RetFar
  650.       mov   bx,ds
  651. @@ok:
  652.       mov   word ptr cs:DOSUpCase,ax
  653.       mov   word ptr cs:DOSUpCase+2,bx
  654.     end ;
  655.   end.
  656.  
  657. ---------------------------------------------------------------
  658. Procedure : MoveBuf
  659. Version   : 1.0
  660. Type      : Bug
  661. File      : Drivers.pas
  662. Reference : Drivers.1
  663. Submitter : Hans Schleichert [100031,775]
  664. Patch :
  665.  
  666.    Change the STOSB into a MOVSB in the MoveBuf procedure.
  667.  
  668.    An alternative fix is to patch DRIVERS.TPU:
  669.  
  670.    Patch the byte $AA at offset decimal 7085 (hex $1BAD) in
  671.    DRIVERS.TPU to $A4 to make the change.
  672.  
  673. ---------------------------------------------------------------
  674.  
  675. Object   : NoWildChars
  676. Version  : 1.0
  677. Type     : Bug
  678. File     : StdDlg.pas
  679. Reference: Views.2
  680. Submitter: Juergen Schlegelmilch
  681. Patch    :
  682.  
  683.   function NoWildChars(S: String): String; assembler;
  684.   asm
  685.           PUSH  DS
  686.           LDS   SI,S            { pointer to argument string }
  687.           LES   DI,@Result      { same to result string }
  688.           XOR   AX,AX
  689.           LODSB               { get length of argument string }
  690.  
  691.           { ** patch: test for empty argument string ** }
  692.  
  693.           OR    AL,AL           { length=0 ? }
  694.           JE    @@3             { -> result = '' }
  695.           XCHG  AX,CX           { else: }
  696.           INC   DI              { skip result length byte }
  697.   @@1:    LODSB               { get char from argument string }
  698.           CMP   AL,'?'          { '?' or '*' ? }
  699.           JE    @@2             { then skip it.. }
  700.           CMP   AL,'*'
  701.           JE    @@2
  702.           STOSB             { else copy it into result string }
  703.   @@2:    LOOP  @@1
  704.           XCHG  AX,DI   { calculate length of result string.. }
  705.           MOV DI,WORD PTR @Result
  706.           SUB AX,DI            { as Endoffset+1 - Startoffset }
  707.           DEC     AX            { don't count the length byte }
  708.   @@3:
  709.           STOSB                 { set length of result string }
  710.           POP DS
  711.   end;
  712.  
  713. ---------------------------------------------------------------
  714.  
  715. Object   : TEditor.ConvertEvent;
  716. Version  : 1.0
  717. Type     : Bug
  718. File     : Editors.pas
  719. Reference: Editors.7
  720. Submitter: Borland
  721. Patch    :
  722.  
  723.    There are actually two sets of changes that must be made.
  724.  
  725.    In the function ScanKeyMap make the following two changes.
  726.  
  727.    EXISTING CODE:                CHANGE TO:
  728.  
  729.    LODSW                         LODSW
  730.    OR      BL,BL                 CMP     BL,DL
  731.    JE      @@2
  732.    CMP     BL,DL
  733.  
  734.    { deleted code }
  735.  
  736.    EXISTING CODE:                CHANGE TO:
  737.  
  738.    JE      @@4                   JE      @@4
  739.    @@2:    CMP     BH,DH         CMP     BH,DH
  740.    JE      @@4                   JE      @@4
  741.  
  742.  
  743.    In the procedure ConvertEvent add the following declaration
  744.    to the variable section and insert the first statement in
  745.    the procedure block.
  746.  
  747.    EXISTING:
  748.  
  749.    var
  750.      Key: Word;
  751.  
  752.    CHANGE TO:
  753.  
  754.    var
  755.      ShiftState : Byte absolute $40:$17;  { added variable }
  756.      Key : Word;
  757.  
  758.    begin
  759.      if (ShiftState and $03 <> 0)         { added statement }
  760.         and (Event.ScanCode >= $47)
  761.             and (Event.ScanCode <= $51)
  762.         then Event.CharCode := #0;
  763.      Key := Event.KeyCode;
  764.  
  765. ---------------------------------------------------------------
  766.  
  767. Object   : TEditor.HandleEvent;
  768. Version  : 1.0
  769. Type     : Bug
  770. File     : Editors.pas
  771. Reference: Editors.3
  772. Submitter: Juergen Schlegelmilch
  773. Patch    :
  774.  
  775.   There are two places that need to be patched, the local
  776.   procedure CheckScrollBar should be changed to a function and
  777.   the handling of the evBroadcast cmScrollBarChanged in the
  778.   HandleEvent main loop.
  779.  
  780.   { function CheckScrollBar:Boolean returns False, if the }
  781.   { sending scrollbar was not the scrollbar in question.  }
  782.  
  783.   function CheckScrollBar (P : PScrollBar;
  784.                            var D : Integer) : Boolean;
  785.   begin
  786.     if (Event.InfoPtr = P) and (P^.Value <> D)
  787.        then begin
  788.               D := P^.Value;
  789.               Update(ufView);
  790.               CheckScrollBar := True;
  791.             end
  792.        else CheckScrollBar := False;
  793.   end;
  794.  
  795.     { HandleEvent main loop patch }
  796.  
  797.   begin
  798.  
  799.     (* ... several lines skipped ... *)
  800.  
  801.     evBroadcast :
  802.       case Event.Command of
  803.         cmScrollBarChanged :
  804.             { The EXIT prevents the Event from being cleared. }
  805.           if not(CheckScrollBar(HScrollBar, Delta.X) or
  806.                    CheckScrollBar(VScrollBar, Delta.Y))
  807.              then Exit;
  808.       else Exit;
  809.  
  810.     (* ... several lines skipped ... *)
  811.  
  812.     ClearEvent(Event);
  813.   end;
  814.  
  815. ---------------------------------------------------------------
  816.  
  817. Object   : TEditor.HandleEvent;
  818. Version  : 1.0
  819. Type     : Bug
  820. File     : Editors.pas
  821. Reference: Editors.6
  822. Submitter: Juergen Schlegelmilch
  823. Patch    :
  824.  
  825.   TEditor.HandleEvent(var Event: TEvent);
  826.   begin
  827.  
  828.   (* ... several lines skipped ... *)
  829.  
  830.       evKeyDown:
  831.         case Event.CharCode of
  832.           #9,#32..#255:
  833.             begin
  834.               Lock;
  835.       { patch: reset blockmarkers if not overwriting }
  836.               if Overwrite then
  837.                 begin
  838.                   if CurPtr <> LineEnd(CurPtr) then
  839.                      SelEnd := NextChar(CurPtr)
  840.                 end
  841.               else
  842.                 SelEnd := SelStart;
  843.               InsertText(@Event.CharCode, 1, False);
  844.               TrackCursor(CenterCursor);
  845.               Unlock;
  846.             end;
  847.         else
  848.           Exit;
  849.         end;
  850.  
  851.   (* ... several lines skipped ... *)
  852.  
  853.   end;
  854.  
  855. ---------------------------------------------------------------
  856.  
  857. Object   : TEditor.NextWord;
  858. Version  : 1.0, 2.0
  859. Type     : Enhancement
  860. File     : Editors.pas
  861. Reference: Editors.5
  862. Submitter: Juergen Schlegelmilch
  863. Patch    :
  864.  
  865.   function TEditor.NextWord(P: Word): Word;
  866.   begin
  867.     if BufChar(P) in WordChars
  868.        then while (P < BufLen) and (BufChar(P) in WordChars) do
  869.              P := NextChar(P)
  870.        else  P := NextChar(P);
  871.     while (P < BufLen) and
  872.           ((BufChar(P) = ' ') or (BufChar(P) = #9)) do
  873.           P := NextChar(P);
  874.     NextWord := P;
  875.   end ;
  876.  
  877. ---------------------------------------------------------------
  878.  
  879. Object   : TFileDialog.GetFileName
  880. Version  : 1.0, 2.0
  881. Type     : Bug
  882. File     : StdDlg.pas
  883. Reference: Views.1
  884. Submitter: Borland
  885. Patch    :
  886.  
  887.    Change the local function RelativePath to the following:
  888.  
  889.    FUNCTION RelativePath (VAR S : PathStr) : Boolean;
  890.    BEGIN
  891.      S := LTrim(RTrim(S));
  892.      RelativePath := NOT ((S <> '') AND
  893.                          ((S[1] = '\') OR (S[2] = ':')));
  894.    END;
  895.  
  896.  
  897. ---------------------------------------------------------------
  898.  
  899. Object   : TFileEditor.InitBuffer;
  900. Version  : 1.0, 2.0
  901. Type     : Bug
  902. File     : Editors.pas
  903. Reference: Editors.1
  904. Submitter: Juergen Schlegelmilch
  905. Patch    :
  906.  
  907.   PROCEDURE TFileEditor.InitBuffer;
  908.   BEGIN
  909.     NewBuffer(Pointer(Buffer));
  910.     BufSize:=0;                  {* new line *}
  911.   END;
  912.  
  913. ---------------------------------------------------------------
  914.  
  915. Object   : TFileEditor.InsertBuffer;
  916. Version  : 1.0
  917. Type     : Bug
  918. File     : Editors.pas
  919. Reference: Editors.4
  920. Submitter: Juergen Schlegelmilch
  921. Patch    :
  922.  
  923.   function TEditor.InsertBuffer (var P : PEditBuffer;
  924.            Offset, Length : Word;
  925.            AllowUndo, SelectText : Boolean) : Boolean;
  926.   var
  927.     SelLen, DelLen, SelLines, Lines: Word;
  928.     NewSize: Longint;
  929.   begin
  930.  
  931.   (* ... several lines skipped ... *)
  932.  
  933.     if NewSize > BufLen + DelCount
  934.        then if (NewSize > $FFF0) or not SetBufSize(NewSize)
  935.              then begin
  936.                       EditorDialog(edOutOfMemory, nil);
  937.  
  938.    { ** patch - reset block markers to avoid abnormal ** }
  939.    { ** behavior of a following BackSpace:            ** }
  940.  
  941.                       SelEnd := SelStart;
  942.                       InsertBuffer := False;
  943.                       Exit;
  944.                     end;
  945.  
  946.   (* ... several lines skipped ... *)
  947.  
  948.     SetBufSize(BufLen + DelCount);
  949.     if (SelLines = 0) and (Lines = 0)
  950.        then Update(ufLine)
  951.        else Update(ufView);
  952.   end;
  953.  
  954. ---------------------------------------------------------------
  955.  
  956. Object   : THelpIndex.Position;
  957. Version  : 1.0
  958. Type     : Bug
  959. File     : HelpFile.pas
  960. Reference: Help.2
  961. Submitter: Juergen Schlegelmilch
  962. Patch    :
  963.  
  964.   function THelpIndex.Position(I: Integer): Longint;
  965.   begin
  966.     if (-1 < I) and (I < Size)
  967.        then Position := Index^[I]
  968.        else Position := -1;
  969.   end;
  970.  
  971. ---------------------------------------------------------------
  972.  
  973. Object   : THelpTopic.AddCrossRef;
  974. Version  : 1.0
  975. Type     : Bug
  976. File     : HelpFile.pas
  977. Reference: Help.1
  978. Submitter: Juergen Schlegelmilch
  979. Patch    :
  980.  
  981.   procedure THelpTopic.AddCrossRef(Ref: TCrossRef);
  982.   var
  983.     P: PCrossRefs;
  984.   begin
  985.     GetMem(P, (NumRefs+1) * SizeOf(TCrossRef));
  986.     if NumRefs > 0 then
  987.     begin
  988.       Move(CrossRefs^, P^, NumRefs * SizeOf(TCrossRef));
  989.       FreeMem(CrossRefs, NumRefs * SizeOf(TCrossRef));
  990.     end;
  991.     CrossRefs := P;  { ** line added ** }
  992.     CrossRefs^[NumRefs] := Ref;
  993.     Inc(NumRefs);
  994.   end;
  995.  
  996. ---------------------------------------------------------------
  997.  
  998. Object   : THistory.Draw;
  999. Version  : 1.0
  1000. Type     : Bug
  1001. File     : Dialogs.pas
  1002. Reference: Views.3
  1003. Submitter: Juergen Schlegelmilch
  1004. Patch    : None
  1005.  
  1006. ---------------------------------------------------------------
  1007.  
  1008. Object   : TWindows.SetState;
  1009. Version  : 1.0, 2.0
  1010. Type     : Bug
  1011. File     : Views.pas
  1012. Reference: Windows.1
  1013. Submitter: Hans Schleichert
  1014. Patch    :
  1015.  
  1016.    Enclose the wfGrow + wfMove in parentheses.
  1017.  
  1018.    For Version 1.0, change the SetState method or override to:
  1019.  
  1020.     PROCEDURE TMyWindow.SetState (AState : Word ; Enable :
  1021.                                   Boolean) ;
  1022.         BEGIN
  1023.             TWindow.SetState (AState, Enable) ;
  1024.             IF (AState = sfSelected) AND Enable THEN
  1025.             IF Flags AND (wfGrow+wfMove) = 0 THEN
  1026.                  {      ^^^           ^^^           }
  1027.                  { these parenthesis are the patch }
  1028.             DisableCommands ([cmResize])
  1029.         END;
  1030.  
  1031.    For Version 2.0, change the following line in the SetState
  1032.       method from:
  1033.  
  1034.    IF Flags AND wfGrow + wfMove <> 0 then
  1035.       WindowCommands := WindowCommands + [cmReSize];
  1036.  
  1037.    TO:
  1038.  
  1039.    IF Flags AND (wfGrow + wfMove) <> 0 then
  1040.       WindowCommands := WindowCommands + [cmReSize];
  1041.  
  1042.  
  1043.  
  1044. ---------------------------------------------------------------
  1045. End of TVBUGS.PAS
  1046.